Main Page | Class Hierarchy | Class List | Class Members

BustaNetClient Class Reference

Client network interface to Busta'Sandwich. More...

#include <BustaNetClient.h>

List of all members.

Public Member Functions

 BustaNetClient ()
 Constructor.
 ~BustaNetClient ()
 Destructor.
char * init ()
 Initializes the client and prepares it for connection.
char * connect (char *IP, Uint16 serverPort)
 Connects to a server using a given port.
void disconnect ()
 Disconnects from the server.
BustaModelMPGameState * getMPGS ()
 Returns game state information about opponent players.
BustaNetMsgQgetPriorityQ ()
 Returns the server priority message queue.
BustaNetMsgQgetSandwichQ ()
 Returns the special sandwich queue.
char * getServerName ()
 Returns the name of the server connected to.
MPConnectResponsejoinGame (char *playerName)
 Joins the server multiplayer game.
void processNet ()
 Handles all incoming network data.
void sendCharSelect (BustaModelCharacter character)
 Sends character selection of player.
void sendCursor (BustaModelPosition *cursor)
 Sends current character selection cursor position of player.
void sendGameOver ()
 Notifies the server that the player has lost the game.
void sendOpponentViewReq (int opponentID)
 Tells the server which opponent the player wishes to view.
void sendReady ()
 Sends a ready message to the server.
void sendSandwich (int opponentID, SpecialSandwich sandwich)
 Sends a spcial sandwich across the network.
void sendState (BustaModelGameState *gs)
 Sends player's game state to the server.


Detailed Description

Client network interface to Busta'Sandwich.

Busta'Sandwich Client for networked multiplayer games.


Constructor & Destructor Documentation

BustaNetClient::BustaNetClient  ) 
 

Constructor.

Initializes variables

BustaNetClient::~BustaNetClient  ) 
 

Destructor.

Close any open connections and shutdown SDLNet


Member Function Documentation

char * BustaNetClient::connect char *  IP,
Uint16  serverPort
 

Connects to a server using a given port.

The client initializes a TCP connection with the server on the specified port.

Parameters:
IP The IP address of the server to connect to.
serverPort The port of the server to connect to.
Returns:
A cstring containing information about the connection. Returns NULL on successful connection to the server, or a cstring about connection failure on an unsuccessful connection.

void BustaNetClient::disconnect  ) 
 

Disconnects from the server.

The connection between the server and client is disconnected. Subsequent connections may be made using the client

BustaModelMPGameState * BustaNetClient::getMPGS  ) 
 

Returns game state information about opponent players.

Returns a pointer to a BustaModelMPGameState containing information about opponent players.

Returns:
A BustaModelMPGameState containing opponent game states
See also:
BustaModelMPGameState

BustaNetMsgQ * BustaNetClient::getPriorityQ  ) 
 

Returns the server priority message queue.

Returns the queue of messages from the server. These messages do not cover special sandwiches or game states.

Returns:
A BustaNetMsgQ pointer to a server message queue
See also:
BustaNetMsgQ

BustaNetMsgQ * BustaNetClient::getSandwichQ  ) 
 

Returns the special sandwich queue.

Returns the queue of special sandwiches sent between players in a multiplayer game.

Returns:
A BustaNetMsgQ pointer to a special sandwich message queue
See also:
BustaNetMsgQ

char * BustaNetClient::getServerName  ) 
 

Returns the name of the server connected to.

Returns the name of the server the client is currently connected to.

Returns:
The name of the server

char * BustaNetClient::init  ) 
 

Initializes the client and prepares it for connection.

Initializes SDLNet. Relays any error message back.

Returns:
Returns a cstring containing an error message if SDLNet cannot be initialized. On no error, null is returned.

MPConnectResponse * BustaNetClient::joinGame char *  playerName  ) 
 

Joins the server multiplayer game.

This method attempts to connect the client to the multiplayer game hosted by the server. The client should be connected to the server before running this method.

Parameters:
playerName The name the player wishes to use for the multiplayer game. Names longer than 20 characters will be truncated.
Returns:
A MPConnectResponse with the server's response to the client's connect attempt. Returns null if the client is not already connected to the server.
See also:
connect()

void BustaNetClient::processNet  ) 
 

Handles all incoming network data.

Processes all data currently queued on the TCP socket. The data is partitioned out into three message containers. Each of these three message containers is accessible through an accompanying accessor method.

See also:
getMPGS()

getPriorityQ()

getSandwichQ()

void BustaNetClient::sendCharSelect BustaModelCharacter  character  ) 
 

Sends character selection of player.

Sends the character selection by the player to the server to be sent to all connected players.

Parameters:
character The selected character

void BustaNetClient::sendCursor BustaModelPosition *  cursor  ) 
 

Sends current character selection cursor position of player.

Sends the current position of the player's cursor during multiplayer character selection.

Parameters:
cursor The cursor position of the player's character selection cursor

void BustaNetClient::sendGameOver  ) 
 

Notifies the server that the player has lost the game.

A message is sent to the server to notify it that the player has lost in the current multiplayer game.

void BustaNetClient::sendOpponentViewReq int  opponentID  ) 
 

Tells the server which opponent the player wishes to view.

A message is sent to the server to tell it which opponent the player wishes to have a detailed view of. The detailed view contains information to display the entire screen of the opponent rather than limited brief data.

Parameters:
opponentID The identification of the opponent whom the player wishes to view

void BustaNetClient::sendReady  ) 
 

Sends a ready message to the server.

Sending a ready message to the server indicates that the client is ready to begin the multiplayer game. The ready state is visible to all other clients and is used to determine when the server should transition from the accepting connections state.

void BustaNetClient::sendSandwich int  opponentID,
SpecialSandwich  sandwich
 

Sends a spcial sandwich across the network.

A special sandwich is sent from the player to an opposing player.

Parameters:
opponentID The identification of the opponent to whom the player wishes to send the sandwich
sandwich The special sandwich to send

void BustaNetClient::sendState BustaModelGameState *  gs  ) 
 

Sends player's game state to the server.

A BustaModelGameState is converted into structs without pointers to form a packet to send to the server. It makes two sends, a packet identifier message, and the netGameState data packet.

Parameters:
gs The game state of the player


Generated on Tue Aug 2 22:03:12 2005 for BustaSandwich Networking by  doxygen 1.4.2-20050421